package com.study.blog.controller;

import com.study.blog.service.CategoryService;
import com.study.blog.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 1
 * @data 2022/2/18
 */
@RestController
@RequestMapping("categorys")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @GetMapping
    public Result categories(){
        return categoryService.findAll();

    }

    @GetMapping("detail")
    public Result detail(){
        return categoryService.detail();
    }

    @GetMapping("detail/{id}")
    public Result CategoryDetail(@PathVariable("id") Long id){
        return categoryService.CategoryDetail(id);
    }
}
